<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
		<h>图片不在同域下，需要通过这种方式</h>
		<script type="text/javascript">
			var fileList = [
				{name:'1xx.png',path:'https://tse1-mm.cn.bing.net/th?id=OIP.DH-sl0dYREvLnyAcBuOlnQHaLH&w=127&h=160&c=8&rs=1&qlt=90&pid=3.1&rm=2'},
				{name:'2xx.png',path:'https://tse1-mm.cn.bing.net/th?id=OIP.DH-sl0dYREvLnyAcBuOlnQHaLH&w=127&h=160&c=8&rs=1&qlt=90&pid=3.1&rm=2'},
				{name:'xxx.png',path:'https://tse1-mm.cn.bing.net/th?id=OIP.DH-sl0dYREvLnyAcBuOlnQHaLH&w=127&h=160&c=8&rs=1&qlt=90&pid=3.1&rm=2'}
			]
			function download(file){
				var xhr = new XMLHttpRequest();
				        xhr.open('GET', file.path, true);
				        xhr.responseType = 'blob';
				        xhr.onload = function(e) {
				            if (xhr.status === 200) {
				                var a = document.createElement('a');
								a.setAttribute('href',window.URL.createObjectURL(this.response))
								a.setAttribute('download',file.name)
								document.body.appendChild(a)
								a.click()
				            }
				};
				xhr.send();
			}
			 fileList.map(item=>{
			 	download(item)
			 })
		</script>
	</body>
</html>
